﻿<div ng-controller="articleListCtrl" id="articleList">
    <table class="table table-hover table-condensed ">
        <tbody>
            <tr ng-repeat="article in list" ng-class="{selected: $index==selectedIndex}" ng-click="select($index)" ng-mouseenter="activate($index)" ng-mouseleave="deactivate($index)">
                <td>
                    <div ng-if="article.TypeID == 1">
                        <a ng-href="#/sitems/{{article.ID}}">{{article.Name}}</a>
                    </div>
                    <div ng-if="article.TypeID == 2">
                        <a ng-href="#/titems/{{article.ID}}">{{article.Name}}</a>
                    </div>
                </td>
                <td class="text-right">
                    <button class="btn btn-default btn-xs" style="visibility:hidden">&nbsp;</button>
                    <span ng-show="$index==activeIndex">
                        <a href="#/article/{{article.ID}}" ng-click="edit($index,$event);"><span class="glyphicon glyphicon-edit"></span></a>
                        <a ng-click="remove($index, $event);"><span class="glyphicon glyphicon-remove"></span></a>
                    </span>
                </td>
            </tr>            
        </tbody>
    </table>    
    <form id="addListForm" name="addListForm" class="form-inline" role="form" ng-controller="articleAddCtrl" ng-class="{'has-simplebox-error' : (!addListForm.$valid && savedPressed) === true}">
        <span class="glyphicon glyphicon-plus"></span>
        <div class="form-group">
            <input type="text" class="form-control simplebox" id="name" ng-bind="article.Name" ng-model="article.Name" placeholder="add new list" autofocus ng-enter="save()" required ng-maxlength="50">
        </div>
    </form>
</div>